/*package controllers;

import java.util.LinkedList;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import org.hibernate.engine.Status;

import models.*;
import models.Exercise;
import play.cache.Cache;
import play.db.jpa.Model;
import play.libs.Mail;
import play.mvc.*;
import models.Tutorial.*;


public class Notifications extends Controller {

   
    
 	    	
    		
       //...........>Dana Tubeileh
  	   public static String [] FindReviewers() {  // a method that returns an array of reviewers' mails 
  		int c = (RegisteredUser.findAll().size());   // saving the size of the RegisteredUsers' column in a variable  
  		String []  allRUsers = new String[c];         // creating an array that has the length of all the users in the database
  		for(int i = 0 ; i < allRUsers.length ; i++) { // looping on the array of allRUsers
  			String mail = (session.get("email")); // getting the id of the user 
  			RegisteredUser u = RegisteredUser.findById(mail); // getting the mail
  			if (u.isReviewer() == true && mail != null ) { //?? checks if the user is a reviewer or not and that the mail does not equal null
  			allRUsers[i] = mail; // putting the id of the user in the created array
  		}
  			}
  		return allRUsers; // returning the array of reviewers' mails
  	}
  	
  
        //...........>Dana Tubeileh 	 
  		public static void sendReviewExerciseMessage(String to) throws EmailException { // this method Sends an invitation email message to a reviewer. The message contains a link
        // which redirects the reviewer to the accept/reject page. 
     
	    String [] r = FindReviewers(); //  saves the output of the FindReviewers() in an array of emails 
	
        String username = "Reviewer"; // setting the name to reviewer 
        long eId = Long.parseLong(session.get("ExerciseId").toString()); // saving the exercise id to be reviewed 
        String exercise = Long.toString(eId);
        for(int i = 0 ; i < r.length ; i ++) { // looping the array of reviewers' emails 
        String link = String.format("http://localhost:9000/Application/Exercise.html?eId=%s", exercise); // the format of the link
                                        
        String message = String .format( "Dear %s,\nYou have been invited to review the exercise having an id of \"%s\" .\nTo accept/reject please click the following link: \n%s",
                username, eId, link); // the format of the message
                                       
        SimpleEmail email = new SimpleEmail(); // creating an email
        email.setFrom("dana.tubeileh91@gmail.com"); // the sender has a standard mail
        email.addTo(r[i]); // the receiver
        email.setMsg(message); // setting the message
        Mail.send(email); // sending the message
        
        
}
}

    public static void homePage() {
    
        render();
        
        } 
    
    public static void viewExercise(){
    	//render 
    	//boolean (true or not);
    }
    
    public static void publishExercise() { //this method publishes the exercise after accepting it 
		
		if(Exercise.ispublished == false) { 
			Exercise.ispublished = true;
		}
		
		else {
			System.out.println("This exercise is already published !!!");
		}
		
		
}
}
    	
    	*/